//
//  LeadViewController.m
//  HaoDou
//
//  Created by dllo on 15/12/19.
//  Copyright © 2015年 HS. All rights reserved.
//

#import "LeadViewController.h"

@interface LeadViewController ()
@property (nonatomic,retain) UIImageView *imageview;
@end

@implementation LeadViewController
- (void)dealloc
{
    [_imageview release];
    [super dealloc];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self initGuide];
}
- (void)initGuide{
    UIScrollView *scrollview = [[UIScrollView alloc]initWithFrame:self.view.bounds];
    [scrollview setContentSize:CGSizeMake(self.view.frame.size.width * 3, 0)];
    scrollview.pagingEnabled = YES;
    scrollview.showsHorizontalScrollIndicator = NO;
    scrollview.bounces = NO;
    for (int i = 0; i < 3; i++) {
        self.imageview = [[UIImageView alloc]initWithFrame:CGRectMake(i * self.view.frame.size.width ,0, self.view.frame.size.width, self.view.frame.size.height)];
        NSString *string = [NSString stringWithFormat:@"%d.jpg",i];
        self.imageview.image = [UIImage imageNamed:string];
        [scrollview addSubview:self.imageview];
        [_imageview release];
        if (i == 2) {
            UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
            button.frame = CGRectMake(self.view.frame.size.width / 2 - 50 , self.view.frame.size.height - 100, 100, 50);
            [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            button.layer.cornerRadius = 10;
            button.backgroundColor = [UIColor orangeColor];
            [button setTitle:@"立即体验" forState:UIControlStateNormal];
            [button addTarget:self action:@selector(ButtonDidPress:) forControlEvents:UIControlEventTouchUpInside];
            [self.imageview addSubview:button];
        }
        self.imageview.userInteractionEnabled = YES;
    }
    [self.view addSubview:scrollview];
    [scrollview release];
}

- (void)ButtonDidPress:(UIButton *)sender{
    [self.delegate chooseVC];
}



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
